#ifndef CONNECTIONTHREAD_H
#define CONNECTIONTHREAD_H

#include <QThread>
#include <QtNetwork/QTcpSocket>
#include <QtNetwork/QHostAddress>
#include <QStringList>


#define SOCKET_TIMEOUT 1000

class ConnectionThread : public QThread
{
    Q_OBJECT
    const int max_alarms;
    QTcpSocket* m_socket;
    QString m_ipString;
    bool m_exit;
    bool m_connected;
    bool* m_alarmEvent;
    bool tryConnectToHost();

public:
    ConnectionThread(const QString& ipString);
    ~ConnectionThread();

    void run();
    void connectToHost(const QString& ip);
    void exit_thread();

signals:
    void sig_connected();
    void sig_cant_connect();
    void sig_event_at(int,bool);
    void sig_info(int,bool,bool);
};

#endif // CONNECTIONTHREAD_H
